#include<stdlib.h>
#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<string.h>

struct persons {
    char * name;
    int age;
};

int main(int argc,char **argv){

    int shmid;
    char *shmstr;
    struct persons pp;
    pp.name = "张三";
    pp.age = 34;
    
    shmid = shmget((key_t)0x5000,1024,0644|IPC_CREAT);
    printf(" 我的进程号是 %d \n",getpid());
    

    shmstr = (char *)shmat(shmid,0,0);
    if (strlen(shmstr)==0)
    {
        printf(" %s \n","nothing");
        exit(0);
        
    }else{
        printf(" 数据是： %s \n",shmstr);
    }
    
    


   return 0;
}